//
//  XBSegmentedControlCellCollectionViewCell.m
//  FamilyDoctor
//
//  Created by xxb on 2017/11/15.
//  Copyright © 2017年 zoenet. All rights reserved.
//

#import "XBSegmentedControlCell.h"

@interface XBSegmentedControlCell()

@end

@implementation XBSegmentedControlCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.font = [UIFont systemFontOfSize:FontSize];
        self.titleLabel.textColor = rgb(34, 34, 34);
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.titleLabel];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    if(!CGRectEqualToRect(self.titleLabel.frame, self.labelFrame)){
        self.titleLabel.frame = self.labelFrame;
    }
}

-(void)setSelected:(BOOL)selected{
    if(selected && !self.noBlodWhenSelected){
        self.titleLabel.font = [UIFont boldSystemFontOfSize:FontSize];
    }else{
        self.titleLabel.font = [UIFont systemFontOfSize:FontSize];
    }
    
    if(selected && self.textColorSelected){
        self.titleLabel.textColor = self.textColorSelected;
    }else{
        //默认颜色
        self.titleLabel.textColor = rgb(34, 34, 34);
    }
}

@end
